package com.njym.java.security.app.biz;

import com.njym.java.security.app.entity.PhotoContent;
import com.njym.java.security.app.mapper.PhotoContentMapper;
import com.njym.java.security.common.biz.BaseBiz;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 
 *
 * @author lijie
 * @email 717057076@qq.com
 * @date 2019-11-25 10:28:11
 */
@Service
public class PhotoContentBiz extends BaseBiz<PhotoContentMapper,PhotoContent> {

    @Resource
    private PhotoContentMapper photoContentMapper;

//    @Cache(key="photoContentMapper")
    public List<PhotoContent> selectListsById(int id, int userId) {
        List<PhotoContent> list =  photoContentMapper.selectListsById(id, userId);
        return list;
    }

    public void deletePhotoById(int id, int userId) {
        photoContentMapper.deletePhotoById(id, userId);
    }

    public void addPhotos(int id, String pic, int userId) {
        PhotoContent photoContent = new PhotoContent();
        photoContent.setPhotoId(id);
        photoContent.setDeleted(0);
        photoContent.setPic(pic);
        photoContent.setAttr1(userId);
        photoContent.setCreateTime(new Date());
        photoContentMapper.insertSelective(photoContent);
    }

}